const { createServer: createServerHttps } = require('https');
const { createServer } = require('http');
const { readFileSync } = require('fs');
const app = require('./src/app/app');
const { APP_PORT, APP_HTTPS_PORT } = require('./src/config/config.default')

const httpsOption = {
 key: readFileSync('../rsa/localhost.key'),
 cert: readFileSync('../rsa/localhost.pem')
};

createServerHttps(httpsOption, app.callback()).listen(APP_HTTPS_PORT, () => {
 console.log(`https://localhost:${APP_HTTPS_PORT}`)
});
createServer(app.callback()).listen(APP_PORT, () => {
 console.log(`http://localhost:${APP_PORT}`)
});
